{% load i18n %}
<div id="menu">
{% if user.is_authenticated %}
	<ul>
		<a {% if not bots_touchscreen %} href="/home" {% endif %} >{% trans 'Home' %}</a>
		<li><a href="/home/">{% trans 'Home' %}{% if not bots_touchscreen %} *{% endif %}</a></li>
		<li><a href="http://code.google.com/p/bots/wiki/MonitorIntroduction">{% trans 'Help' %}</a></li>
		<li><a href="/logout/">{% trans 'Log out' %}</a></li>
		<li><a href="/admin/password_change/">{% trans 'Change password' %}</a></li>
	</ul>
	<ul>
		<a {% if not bots_touchscreen %} href="/incoming/?last" {% endif %} >{% trans 'Last run' %}</a>
		<li><a href="/reports/?all" >{% trans 'Report (per run)' %}</a></li>
		<li><a href="/incoming/?last" >{% trans 'Incoming' %}{% if not bots_touchscreen %} *{% endif %}</a></li>
		<li><a href="/document/?last" >{% trans 'Document' %}</a></li>
		<li><a href="/outgoing/?last" >{% trans 'Outgoing' %}</a></li>
		<li><a href="/processes/?last" >{% trans 'Process Errors' %}</a></li>
	</ul>
	<ul>
		<a {% if not bots_touchscreen %} href="/reports/?all" {% endif %} >{% trans 'All runs' %}</a>
		<li><a href="/reports/?all" >{% trans 'Report (per run)' %}{% if not bots_touchscreen %} *{% endif %}</a></li>
        <li><a href="/incoming/?all" >{% trans 'Incoming' %}</a></li>
		<li><a href="/document/?all" >{% trans 'Document' %}</a></li>
		<li><a href="/outgoing/?all" >{% trans 'Outgoing' %}</a></li>
		<li><a href="/processes/?all" >{% trans 'Process Errors' %}</a></li>
		<li><a href="/confirm/?all" >{% trans 'Confirmations' %}</a></li>
	</ul>
	<ul>
		<a {% if not bots_touchscreen %} href="/document/?select" {% endif %} >{% trans 'Select' %}</a>
		<li><a href="/reports/?select" >{% trans 'Reports (per run)' %}</a></li>
        <li><a href="/incoming/?select" >{% trans 'Incoming' %}</a></li>
		<li><a href="/document/?select" >{% trans 'Document' %}{% if not bots_touchscreen %} *{% endif %}</a></li>
		<li><a href="/outgoing/?select" >{% trans 'Outgoing' %}</a></li>
		<li><a href="/processes/?select" >{% trans 'Process Errors' %}</a></li>
		<li><a href="/confirm/?select" >{% trans 'Confirmations' %}</a></li>
	</ul>
	{% if user.is_staff %}
	<ul>
		<a>{% trans 'Configuration' %}</a>
		{% if perms.bots.change_routes %}<li><a href="/admin/bots/routes/" >{% trans 'Routes' %}</a></li>{% endif %}
		{% if perms.bots.change_channel %}<li><a href="/admin/bots/channel/" >{% trans 'Channels' %}</a></li>{% endif %}
		{% if perms.bots.change_translate %}<li><a href="/admin/bots/translate/" >{% trans 'Translations' %}</a></li>{% endif %}
		{% if perms.bots.change_partner %}<li><a href="/admin/bots/partner/" >{% trans 'Partners &amp; groups' %}</a></li>{% endif %}
		{% if perms.bots.change_confirmrule %}<li><a href="/admin/bots/confirmrule/" >{% trans 'Confirmrules' %}</a></li>{% endif %}
		{% if perms.bots.change_ccode %}<li><a href="/admin/bots/ccode/" >{% trans 'User Codes list' %}</a></li>{% endif %}
		{% if perms.bots.change_ccodetrigger %}<li><a href="/admin/bots/ccodetrigger/" >{% trans 'User Code types' %}</a></li>{% endif %}
	</ul>
    {% endif %}
    {% if user.is_superuser %}
	<ul>
		<a>{% trans 'SysTasks' %}</a>
		<li><a href="/plugin/" >{% trans 'Read plugin' %}</a></li>
		<li><a href="/plugout/" >{% trans 'Make plugin' %}</a></li>
		<li><a href="/delete/" >{% trans 'Delete from configuration' %}</a></li>
        <li><hr/></li>
		<li><a href="/admin/auth/user/" >{% trans 'Users' %}</a></li>
		<li><a href="/admin/auth/group/" >{% trans 'UserGroups' %}</a></li>
        <li><hr/></li>
		<li><a href="/unlock/" OnClick = "return confirm('{% trans 'If database is locked due to a system crash, you should run crash recovery instead.\n\nAre you sure you just want to unlock the database?' %}');">{% trans 'Unlock database' %}</a></li>
		<li><a href="/runengine/?clparameter=--crashrecovery"  OnClick = "return confirm('{% trans 'Only needed in case of database lock/system crash.\n\nAre you sure?' %}');">{% trans 'Run crash recovery' %}</a></li>
		<li><a href="/admin/bots/uniek/" >{% trans 'View/edit counters' %}</a></li>
		<li><a href="/sendtestmail/">{% trans 'Send test report' %}</a></li>
	</ul>
    {% endif %}
	{% if perms.bots.change_mutex %} <!-- change mutex permission is required to run bots-engine! -->
	<ul>
		<a>{% trans 'Run' %}</a>
		<li><a href="/runengine/?clparameter=--new" >{% trans 'Run (only new)' %}</a></li>
        <li><hr/></li>
		<li><a href="/runengine/?clparameter=--retransmit" >{% trans 'Run user-indicated retransmits' %}</a></li>
		<li><a href="/runengine/?clparameter=--retrycommunication" >{% trans 'Retry user-indicated comm errors' %}</a></li>
		<li><a href="/runengine/?clparameter=--retry"  OnClick = "return confirm('{% trans 'Are you sure you want to retry ALL previous errors?\n' %}');">{% trans 'Retry all previous errors' %}</a></li>
        {% if menu_all_routes %}
            <li><hr/></li>
            {% for route in menu_all_routes %}
                <li><a href="/runengine/?clparameter={{ route }}" >{{ route }}</a></li>
            {% endfor %}
        {% endif %}
    </ul>
	{% endif %}
	{% if custom_menus %}
	<ul>
		<a>{{ custom_menuname }}</a>
		{% for key,value in custom_menus %}
			{% ifequal '---' value %}
				<li><hr/></li>
			{% else %}
				<li><a href="{{ value }}" >{{ key }}</a></li>
			{% endifequal %}
		{% endfor %}
    </ul>
	{% endif %}

{% else %}
	<ul>
		<a href="/login/">{% trans 'Log in' %}</a>
	</ul>
{% endif %}
		<noscript>{% trans '*****Javascript is not enabled. Bots works better with javascript*****' %}</noscript>
</div>
